﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace Agile_E
{
    public partial class Vehicles : System.Web.UI.Page
    {
        private string make;
        private string model;
        private string VIN;

        protected void Page_PreInit(object sender, EventArgs e)
        {   
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            VIN = Request.QueryString["vin"].ToString();
            Car vehicle = new Car();
            try
            {
                DatabaseHandler.connect();
                vehicle = DatabaseHandler.getCarbyVIN(VIN);
                lblcar.Text = vehicle.Year + " " + vehicle.Make + " " + vehicle.Model;
                txtyear.Text = vehicle.Year.ToString();
                txtmake.Text = vehicle.Make;
                txtmodel.Text = vehicle.Model;
                txtType.Text = vehicle.VehicleType;
                txtVIN.Text = vehicle.VIN_Number.ToString();
                txtExt.Text = vehicle.exColor;
                txtInt.Text = vehicle.inColor;
                txtMileage.Text = vehicle.Mileage.ToString();
                txtEngine.Text = vehicle.EngineType;
                txttrmn.Text = vehicle.Transmission;
                txtFuel.Text = vehicle.fuelType;
                txtDriveType.Text = vehicle.driveType;
                txthp.Text = vehicle.Horsepower.ToString();
                txttq.Text = vehicle.Torque.ToString();
                txtFE.Text =  vehicle.CityFE.ToString() + "/" + vehicle.HighwayFE.ToString();
                txtMSRP.Text = vehicle.TagPrice.ToString();
                txtPrice.Text = vehicle.LowestSalePrice.ToString();
                txtDate.Text = vehicle.DateReceived.ToShortDateString();
                txtFeatures.Text = vehicle.Features;
                txtWarranty.Text = vehicle.Warranty;
                ((Main)((SearchMP)this.Master).Master).clearStatus();

            }
            catch (Exception ex)
            {
                ((Main)((SearchMP)this.Master).Master).writeStatus(ex.Message, true);
            }
        }

        protected void txtWarranty_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
